﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Trainings.aspx.cs" Inherits="Trainings" EnableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register TagPrefix="fc" TagName="FilterControl" Src="~/Controls/FilterWindow.ascx" %>

<asp:Content ID="headContent" ContentPlaceHolderID="HeadContent" Runat="Server">
    <script type="text/javascript" src="../Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.helper.js"></script>
</asp:Content>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" Runat="Server">

    <asp:Panel ID="emptyPanel" runat="server" visible="false">
        <div align="center">
            <h1 > Trainings </h1>
        </div>
    </asp:Panel>

    <asp:Panel ID="trainingsListPanel" runat="server" visible="false" >
        <asp:button runat="server" ID="addNewTrainingButton" text="Adaugarea Unui nou Curs de instruire" onclick="addNewTrainingButton_Click" />
        <hr />
        <asp:GridView ID="trainingsGridView" runat="server" 
            EnableModelValidation="True" 
            AutoGenerateColumns="False" 
            CssClass="mGrid"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt"
            AllowPaging="True"         
            PageSize="10"
            onpageindexchanging="trainingsGridView_PageIndexChanging" 
            onrowdeleting="trainingsGridView_RowDeleting" 
            onselectedindexchanged="trainingsGridView_SelectedIndexChanged" 
            onrowdatabound="trainingsGridView_RowDataBound">
            <AlternatingRowStyle CssClass="alt" />
            <Columns>
                <asp:BoundField DataField="trainingID" HeaderText="trainingID" HtmlEncode="False" HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass="HiddenColumn" />
                
                <asp:TemplateField HeaderText="Data">
                    <ItemTemplate>
                        <asp:Label ID="trainingDateLabel" runat="server" 
                            Text='<%# ((Eval("trainingDate") != null && Eval("trainingDate") is DateTime) ?  ((DateTime)Eval("trainingDate")).ToString(Constants.Constants.ISODateBackwardDotsFormat) : "") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                                
                <asp:BoundField DataField="TrainingName" HeaderText="Denumirea" HtmlEncode="False" />   

                <asp:BoundField DataField="tipulInstruirii_ID" HeaderText="Tipul Instruirii ID" HtmlEncode="False" HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass="HiddenColumn"  />
                <asp:BoundField DataField="tipulInstruirii_ID_string" HeaderText="Tipul Instruirii" HtmlEncode="False" />                   
                <asp:BoundField DataField="DescrirereaInstruirii" HeaderText="Descrierea Instruirii" HtmlEncode="False" /> 
                <asp:BoundField DataField="trainingScop" HeaderText="Scopul" HtmlEncode="False" /> 

                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                            <asp:Button ID="deleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Sunteti sigur ca vreti sa stergeti?');" />
                    </ItemTemplate>
                </asp:TemplateField>  
            </Columns>
            <PagerStyle CssClass="pgr" />
            <SelectedRowStyle BackColor="#CCCCFF" />
        </asp:GridView>
    </asp:Panel>


    <asp:Panel ID="addNewTrainingPanel" runat="server" Visible="False" >
    
    <div>
        <asp:HiddenField ID="trainingOperationHiddenField" runat="server" />
        <asp:HiddenField ID="editTrainingIDHiddenField" runat="server" />
        <asp:ImageButton ID="addNewTrainingBackButton" runat="server" Width="24" Height="24px" BorderWidth="2px" BorderStyle="Solid" ImageAlign="Baseline" ToolTip="Back" ImageUrl="~/App_Images/back.png" onclick="addNewTrainingBackButton_Click"  />
    </div>    
    
    <div class="leftColumn">
        <div class="module">
            <div class="moduleHeader">Adaugarea unui noi curs de instruire</div>
            <div class="module_content">                
                <p>
                    <label> Data: </label>
                    <asp:TextBox ID="addNewTrainingDataTextBox" runat="server" />
                    <ajax:CalendarExtender ID="addNewTrainingDataCalendarExtender" runat="server"  TargetControlID="addNewTrainingDataTextBox" />
                </p>
                <p>
                    <label> Denumirea: </label>
                    <asp:TextBox ID="addNewTrainingNameTextBox" runat="server" />
                </p>
                <p>
                    <label> Conducatorul: </label>  
                    <asp:DropDownList ID="conducatorulDDL" runat="server"></asp:DropDownList>
                </p>
                <p>
                    <label>  Tipul instruirii:</label>
                    <asp:DropDownList ID="addNewTrainingTipInstruireDDL" runat="server" />
                </p>
                <p>
                    <label> Descrirerea Instruirii:</label>
                    <asp:TextBox ID="addNewTrainingDescriereIntruireTextBox" runat="server" TextMode="MultiLine" />
                </p>
                <p>
                    <label>      Scopul instruirii:      </label>
                    <asp:TextBox ID="addNewTraingScopeTextBox" runat="server" />
                </p>
            </div>
        </div>
    </div>
    <div class="rightColumn">
        <div class="module">
            <div class="moduleHeader">Poza comuna</div>
            <div class="module_content">   
                <asp:FileUpload ID="trainingPhotoFileUpload" runat="server"  />
                <asp:Button ID="trainingPhotoUploadButton" runat="server" Text="Upload" onclick="trainingPhotoUploadButton_Click" />
                <br />                    
                <div class="centerBox"> <asp:Image ID="trainingPhotoImage" runat="server"  />  </div> 
            </div>
        </div>
    </div>
    
    <div class="clear"></div>
        
    <div class="CenterColumn">
        <div class="module">    
            <asp:Label ID="Label1" runat="server" Text="Clienti Implicati"></asp:Label>
                    
   
            <div style="overflow-x:scroll;">


                        <asp:gridview ID="newClientGridView" runat="server" ShowFooter="true" 
                            AutoGenerateColumns="false" 
                            onrowdeleting="newClientGridView_RowDeleting">
                            <Columns>        
                                <asp:TemplateField HeaderText="Nr.">
                                    <ItemTemplate>
                                        <asp:Label ID="rowNumberLabel" runat="server" Text='<%# Eval("RowNumber") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                                                
                                <asp:TemplateField HeaderText="Numele">
                                    <ItemTemplate>
                                        <asp:TextBox ID="nameTextBox" runat="server" Width="110px"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Prenumele">
                                    <ItemTemplate>
                                        <asp:TextBox ID="surnameTextBox" runat="server" Width="110px"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Data Nasterii">
                                    <ItemTemplate>
                                         <asp:TextBox ID="birthDateTextBox" runat="server" Width="80px"></asp:TextBox>
                                         <ajax:CalendarExtender ID="CalendarExtender3" runat="server"  TargetControlID="birthDateTextBox" Format="<%# Constants.Constants.ISODateBackwardDotsFormat %>"/>
                                    </ItemTemplate>
                                </asp:TemplateField>   

                                <asp:TemplateField HeaderText="IDNP">
                                    <ItemTemplate>
                                         <asp:TextBox ID="codPersonalTextBox" runat="server" Width="80px"></asp:TextBox>                 
                                    </ItemTemplate>
                                </asp:TemplateField>        
                                                                                      
                                <asp:TemplateField HeaderText="Telefon Fix">
                                    <ItemTemplate>
                                         <asp:TextBox ID="telFixTextBox" runat="server" Width="80px"></asp:TextBox>                 
                                    </ItemTemplate>
                                </asp:TemplateField>        
                                    
                                <asp:TemplateField HeaderText="Telefon Mobil">
                                    <ItemTemplate>
                                         <asp:TextBox ID="telMobil1TextBox" runat="server" Width="90px"></asp:TextBox>                 
                                    </ItemTemplate>
                                </asp:TemplateField>   

                                <asp:TemplateField HeaderText="Email">
                                    <ItemTemplate>
                                         <asp:TextBox ID="emailTextBox" runat="server" Width="90px"></asp:TextBox>                 
                                    </ItemTemplate>
                                </asp:TemplateField>  

                                <asp:TemplateField HeaderText="Localitatea">
                                    <ItemTemplate>
                                         <asp:TextBox ID="localitateaTextBox" runat="server" Width="80px"></asp:TextBox>                 
                                    </ItemTemplate>
                                </asp:TemplateField>  

                                <asp:TemplateField HeaderText="Raion">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="raionDDL" runat="server" Width="100px"></asp:DropDownList>          
                                    </ItemTemplate>
                                </asp:TemplateField>  

                                <asp:TemplateField HeaderText="Grupa">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="sortGroupDDL" runat="server" Width="100px"></asp:DropDownList>          
                                    </ItemTemplate>
                                </asp:TemplateField>  

                                <asp:TemplateField HeaderText="Status">
                                    <ItemTemplate>
                                        <asp:Image ID="statusImage" runat="server" />                                            
                                    </ItemTemplate>
                                </asp:TemplateField>  
                                                                
                                <asp:TemplateField HeaderText="ClientID" ItemStyle-CssClass="HiddenColumn" FooterStyle-CssClass="HiddenColumn" HeaderStyle-CssClass="HiddenColumn">
                                    <ItemTemplate >
                                        <asp:Label ID="clientIDLabel" runat="server" Text='<%# Eval("ClientID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                               
                                <asp:TemplateField HeaderText="Delete">
                                    <ItemTemplate>
                                        <asp:Button ID="deleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Sunteti sigur ca vreti sa stergeti?');" />
                                    </ItemTemplate>
                                </asp:TemplateField>  
                                
                            </Columns>
                        </asp:gridview> 

            </div>
               <asp:Button ID="ButtonAdd" runat="server" Text="Add new" OnClick="ButtonAdd_Click" />
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <fc:FilterControl ID="clientFilter" runat="server" Height="250px" Width="400px" AllowMultiSelection="false" SelectButtonText="Client existent" SelectButtonWidth="150px" TitleWindow="Lista Clientilor Inregistrati"  OnEntrySelected="ClientSelecetd_Event"/>
        </div>
    </div>

    <div class="centerBox">                            
        <asp:Button ID="addNewTrainingSaveButton" runat="server" onclick="addNewTrainingSaveButton_Click" Text="Save" />
        <asp:Button ID="addNewTrainingCancelButton" runat="server" onclick="addNewTrainingCancelButton_Click" Text="Cancel" />                
    </div>
    </asp:Panel>
	 
</asp:Content>

